#ifndef STRAY_GRAPHICS_TEXTURE_H
#define STRAY_GRAPHICS_TEXTURE_H

#include "../Common.h"
#include "../Object/ReferenceObject.h"
#include "../SmartPtr/IntrusivePtr.h"
#include "Format.h"
#include "LockFlag.h"

namespace Stray {
namespace Core {
namespace Graphics {

struct TextureDesc
{
	enum TextureUsage
	{
		TU_TEXTURE,
		TU_RENDERTARGET,
		TU_DEPTHSTENCIL,
	};

	union SurfaceFormat
	{
		TextureFormat textureFormat_;
		RenderTargetFormat renderTargetFormat_;
		DepthBufferFormat depthBufferFormat_;
	};

	TextureUsage usage_;
	Stray::Uint32 width_;
	Stray::Uint32 height_;
	SurfaceFormat format_;
};

struct RectData
{
	void* pData_;
	Stray::Uint32 rowPitch_;
	Stray::Uint32 columnPitch_;
};

class Texture : public Stray::ReferenceObject
{
public:
	virtual ~Texture(){};

	virtual TextureDesc getDesc() const = 0;
	virtual RectData readRect(Stray::Rect *pRect) = 0;
	virtual void writeRect(const void *pData, const Stray::Rect *pRect) = 0;

	virtual void* getNativeHandle() const = 0;
};

typedef Stray::IntrusivePtr<Texture>::type TexturePtr;

}
}
}

#endif